<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="../../../common/taglib.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<sfa:mainTitle></sfa:mainTitle>
		<%@ include file="../../../common/meta.jsp"%>
		<script type="text/javascript"
			src="${path}/script/JQueryRaty/js/jquery.raty.min.js">
</script>
		<script type="text/javascript">
$(function() {
	fixTable.FixTable("mytable");
	$("#btn_submit").click(function() {
		url = "${path}/routine/lecturer/index/apply/${train.saleTrainTakeId}";
		art.dialog( {
			lock : true,
			content : '确定报名吗?',
			ok : function() {
				art.dialog( {
					id : "loading",
					lock : true,
					drag : false,
					resize : false,
					title : "正在报名..."
				});
				$.post(url, null, function(result) {
					art.dialog( {
						id : 'loading'
					}).close();//关闭等待框
						//debugger;
						//alert(result); 
						//result = '(' + result + ')';
						var obj = eval(result);
						if (obj.result == true) {
							art.dialog( {
								icon : "succeed",
								content :obj.message,
								lock : true,
								ok : function() {
									location.reload();
								}
							});
						} else {
							art.dialog( {
								icon : "error",
								content : obj.message,
								lock : true,
								ok : true
							});
						}

					});

				return true;
			},
			cancelVal : '关闭',
			cancel : true
		});
	});

	var point = 3;
	$("#btn_frade")
			.click(
					function() {
						var saleTrainTakeId = $(this).attr("val");
						art
								.dialog( {
									lock : true,
									content : "<div style='width:auto;height:100px;' >请评分:<div id='target'></div></div>",
									ok : function() {
										url = "${path}/routine/lecturer/index/grade";
										var data = {
											point : point,
											saleTrainTakeId : saleTrainTakeId
										}
										$.post(url, data, function(result) {
											art.dialog( {
												id : 'loading'
											}).close();//关闭等待框
												if (result == "true") {
													art.dialog( {
														icon : "succeed",
														content : "评分成功!",
														lock : true,
														ok : function() {
															location.reload();
														}
													});
												} else {
													art.dialog( {
														icon : "error",
														content : "评分失败!",
														lock : true,
														ok : true
													});
												}

											});
									},
									cancel : true,
									init : function() {
										point = 3;
										$('#target')
												.raty(
														{
															path : "${path}/script/JQueryRaty/img",
															start : 3,
															onClick : function(
																	score) {
																point = score;
															}
														});
									}
								});

					});
});

</script>
	</head>
	<body id="master">
		<sfa:mainHeader></sfa:mainHeader>
		<div class="webpart3 contentarea">
			<div class="webpart-head">
				<div class="webpart-head-item">
					销售支持系统培训
				</div>
			</div>
			<div class="webpart-main">
				<div class="webpart-main-item" style="padding-top: 15px;">
					<div class="d_formitem">
						<table cellspacing="0" cellpadding="0" class="formitem">
							<tr>
								<td width="20%">
									培训类型：
								</td>
								<td valign="middle">
									${train.saleTrainTypeName}
								</td>
							</tr>
							<tr>
								<td>
									<span>培训标题：</span>
								</td>
								<td>
									${train.trainItem}
								</td>
							</tr>
							<tr>
								<td>
									<span>讲&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;师：</span>
								</td>
								<td>
									${saletrain.saleTrainerName}
								</td>
							</tr>
							<tr>
								<td>
									<span>培训内容：</span>
								</td>
								<td>
									${train.trainContent}
								</td>
							</tr>
							<tr>
								<td>
									<span>培训状态：</span>
								</td>
								<td>
									${train.saleTrainStatusName}
									</div>
								</td>
							</tr>
							<tr>
								<td>
									<span>最大报名人数：</span>
								</td>
								<td>
									${train.maxApplyCount}
									</div>
								</td>
							</tr>
							<tr>
								<td>
									<span>报名开始时间：</span>
								</td>
								<td>
									<fmt:formatDate value="${train.applyStartDate}"
										pattern="yyyy-MM-dd HH:mm" />
									</div>
								</td>
							</tr>
								<td>
									<span>报名结束时间：</span>
								</td>
								<td>
									<fmt:formatDate value="${train.applyEndDate}"
										pattern="yyyy-MM-dd HH:mm" />
									</div>
								</td>
							</tr>
								<td>
									<span>培训开始时间：</span>
								</td>
								<td>
									<fmt:formatDate value="${train.trainStartDate}"
										pattern="yyyy-MM-dd HH:mm" />
									</div>
								</td>
							</tr>
								<td>
									<span>培训结束时间：</span>
								</td>
								<td>
									<fmt:formatDate value="${train.trainEndDate}"
										pattern="yyyy-MM-dd HH:mm" />
									</div>
								</td>
							</tr>
							<tr>
								<td>
									<span>培训课件：</span>
								</td>
								<td>
									<c:if test='${train.isAffix == "Y"}'>
										<c:forEach items="${download}" var="date">
											<a
												href="${path}/affix/index/download/${date.SALEAFFIXITEMID}">
												${date.SALEAFFIXITEMFILENAME} </a>
										</c:forEach>
									</c:if>
									<c:if test='${train.isAffix == "N"}'>无课件</c:if>
								</td>
							</tr>
							<tr>
								<td>
									<span>产品相关：</span>
								</td>
								<td>
									<c:forEach items="${saleproduct}" var="saleproduct">
										<a
											href="${path}/routine/product/index/detail/${saleproduct.productid}">${saleproduct.productname}
											<br /> </a>
									</c:forEach>
								</td>
							</tr>
						</table>
					</div>
					<div style="margin-top: 5px;">
					<c:if test='${train.trainStatus=="TRAINSTATUS_01" && !isSignUped}'>
						
							<a href="javascript:" class="linkbtn" id="btn_submit" value="报名"
							val="${train.saleTrainTakeId}"><span>报名</span> </a>
									&nbsp;&nbsp; 
					</c:if>
					<c:if
						test='${train.trainStatus=="TRAINSTATUS_05" && isSignUped && grade==null}'>
						<a href="javascript:" class="linkbtn" id="btn_frade" value="评分"
							val="${train.saleTrainTakeId}"><span>评分</span> </a>
					</c:if>
					<c:if
						test='${train.trainStatus=="TRAINSTATUS_05" && isSignUped && grade!=null}'>
						<a href="javascript:" class="linkbtn"><span class="linkbtn">已评分</span>
							&nbsp;&nbsp; 
					</c:if>
					<a href="javascript:" class="linkbtn"
						onclick="location.href='${path}/routine/lecturer/index/join/existing';"><span>返回</span>
					</a>
					</div>
					总报名人数:${agentCount }人
					<div class="in" style="margin-top: 15px;">
						
						<div class="dlist" style="height:170px;overflow: auto" id="mylist">
						<table cellpadding="0" cellspacing="0"
							class="dg_borderstyle trStyleTable" width="99%"  >

								<tr>
									<th name="fixcol">
										<span>营销员代码或身份证号</span>
									</th>
									<th>
										<span>姓名</span>
									</th>
								</tr>
								<c:forEach items="${agentList.resultList}" var="trainAgent">
									<tr>
										<td>
											<span>${trainAgent.TRAINAGENTID}</span>
										</td>
										<td align="center">
											<span>${trainAgent.TRAINAGENTNAME}</span>

										</td>
									</tr>
								</c:forEach>

							</tbody>
						</table>
						</div>
					</div>
				</div>
				<div class="webpart-foot">
					<div class="webpart-foot-item">
					</div>
				</div>
			</div>
		</div>
		<sfa:mainFooter></sfa:mainFooter>
	</body>
</html>